package com.qf.business.score.controller;

import com.qf.commons.web.apiversion.ApiVersion;
import com.qf.data.r.R;
import com.qf.data.r.RUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * description: 学分Controller
 * author: Ken
 * 公众号：Java架构栈
 */
@RestController
@RequestMapping("/score")
@Slf4j
public class ScoreController {

    @ApiVersion(1.0)
    @RequestMapping("/getScoreBySid")
    public R getScoreBySid(Long sid){
        log.debug("[get score] 根据id获取学分信息 - {}", sid);
        double score = 0.0;

        switch (sid.intValue()) {
            case 1:
                score = 8.9;
                break;
            case 2:
                score = 9.2;
                break;
        }

        return RUtils.create(score);
    }

    @ApiVersion(2.0)
    @RequestMapping("/getScoreBySid")
    public R getScoreBySid2(Long sid){
        log.debug("[get score] 根据id获取学分信息 - {}", sid);
        double score = 0.0;

        switch (sid.intValue()) {
            case 1:
                score = 8.9;
                break;
            case 2:
                score = 9.2;
                break;
        }

        return RUtils.create(score);
    }
}
